    var map;
    var markers = [];
    var infoWindow;
    var locationSelect;

    function load(sBaseUrl, iGroupId, lat, lng) {
      map = new google.maps.Map(document.getElementById("map"), {
        center: new google.maps.LatLng(lat, lng),
        zoom: 14,
        mapTypeId: 'roadmap',
        mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
      });
      infoWindow = new google.maps.InfoWindow();
 
	  init(sBaseUrl, iGroupId);
   }
 
   function init(sBaseUrl, iGroupId) {
   
     var searchUrl = sBaseUrl+'map_single/'+iGroupId;
 
     downloadUrl(searchUrl, function(data) {
       var xml = parseXml(data);
       var markerNodes = xml.documentElement.getElementsByTagName("marker");
       var bounds = new google.maps.LatLngBounds();
       
		if (markerNodes.length == 0) {
		   map.setZoom(14);
		} else { 	   
		   for (var i = 0; i < markerNodes.length; i++) {
			 var name = markerNodes[i].getAttribute("name");
			 var address = markerNodes[i].getAttribute("address");
			 var url = markerNodes[i].getAttribute("url");
			 var start = markerNodes[i].getAttribute("start");
			 var end = markerNodes[i].getAttribute("end");
			 var distance = parseFloat(markerNodes[i].getAttribute("distance"));
			 var latlng = new google.maps.LatLng(
				  parseFloat(markerNodes[i].getAttribute("lat")),
				  parseFloat(markerNodes[i].getAttribute("lng")));
 
			 createMarker(latlng, name, address, url);
			 bounds.extend(latlng);
		   }
		   //map.fitBounds(bounds);
	   }
 
      });
    }

    function createMarker(latlng, name, address, url) {
 
	  var html = "<b><a href='"+ url +"'>" + name + "</a> </b> <br/>" + address + "<br/>";
 
      var marker = new google.maps.Marker({
        map: map,
        position: latlng
      });
      google.maps.event.addListener(marker, 'click', function() {
        infoWindow.setContent(html);
        infoWindow.open(map, marker);
      });
      markers.push(marker);
    }
  
    function downloadUrl(url, callback) {
      var request = window.ActiveXObject ?
          new ActiveXObject('Microsoft.XMLHTTP') :
          new XMLHttpRequest;

      request.onreadystatechange = function() {
        if (request.readyState == 4) {
          request.onreadystatechange = doNothing;
          callback(request.responseText, request.status);
        }
      };

      request.open('GET', url, true);
      request.send(null);
    }

    function parseXml(str) {
      if (window.ActiveXObject) {
        var doc = new ActiveXObject('Microsoft.XMLDOM');
        doc.loadXML(str);
        return doc;
      } else if (window.DOMParser) {
        return (new DOMParser).parseFromString(str, 'text/xml');
      }
    }

    function doNothing() {}